package com.atguigu.yygh.common.result;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * 接口统一返回包装类
 * @author Zyyyyu
 */
@Data
@ApiModel(value = "Result",description = "统一返回对象")
public class Result<T> {

    @ApiModelProperty("状态码")
    private String code;

    @ApiModelProperty("信息")
    private String message;

    @ApiModelProperty("返回对象")
    private T data;

    public Result() {
        this.code = "200";
        this.message = "";
    }

    public Result(T data) {
        this.code = "200";
        this.message = "";
        this.data = data;
    }

    public Result(String message) {
        this.code = "200";
        this.message = message;
    }

    public Result(T data, String msg) {
        this.code = "";
        this.message = msg;
        this.data = data;
    }

    public Result(String code, String message) {
        this.code = code;
        this.message = message;
    }

    public Result(String code, T data) {
        this.code = code;
        this.message = "";
        this.data = data;
    }

    public Result(String code, String message, T data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }

}
